package com.cloudlead.common.worker.web;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * Created by dean on 2015/7/28.
 */
public class RemoteServiceProxy implements MethodInterceptor {

    public Object intercept(Object target, Method method
            , Object[] args, MethodProxy proxy)
            throws Throwable {
        Class<?> superclass = target.getClass().getInterfaces()[0];
        return RemoteServiceType.rpc.getClient().executeAction(superclass, method, args);
    }
}
